local drivevar = CreateClientConVar("EnergyDrives",1)
local function warpdrivehook(ent)
	if ent and ent:IsValid() then
//		print("Entity spawn detected "..ent:GetClass())
		if ent:GetClass() == "sent_anim" and drivevar:GetBool() then
//			print("Entity is a warpdrive and the convar is true")
			if ent.Go then
//				print("Entity has Go Function overriding!")
				RD_Register(ent,true)
				ent.energyuse = 500
				ent.oldGo = ent.Go or function() end
				ent.Go = function(self)
				if self:GetResourceAmount("energy") >= self.energyuse then
					self:ConsumeResource("energy", self.energyuse)
					self.oldGo(self)//execute
				else
					self.Entity:EmitSound("WarpDrive/error2.wav", 450, 70)
				end
			end
		end
	end
	end
end
hook.Add("OnEntityCreated", "WarpDriveOverride", warpdrivehook)